package com.example.demo.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class SwaggerConfig {
    private ApiInfo __apiInfo = new ApiInfoBuilder()
                                        .title("考试系统Api")
                                        .description("考试系统Api，获取数据使用GET请求方式，更新数据使用PUT请求方式，删除数据使用DELETE请求方式，")
                                        .contact(new Contact("蓝色的太平洋","","x.qf@foxmail.com"))
                                        .version("0.0.1")
                                        .build();
    @Bean
    public Docket apiDoc(){
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(this.__apiInfo)
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.example.demo"))
                .paths(PathSelectors.any())
                .build();
    }
}
